Fixes #251: segfault (stopClient) and showing error (not active window) #252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, thanks for the application :)
This PR fixes these two errors, reported here #251
It also provides some improvements related to error reporting.
Debugged and found.
I don't know what is the use case to only show the error messages when the current window (main one) is the active one, as those messages are coming from the settings window. But I have found a problematic behavior with it, reported in the issue. I have spent a bunch of time trying to guess what was the error here (not considering that it was a configuration error, since first it segfaulted due to using a null ptr). If I saw the error "no username", I would have just checked configuration and changed it. So, definitely, there is value in showing errors independently of the active window.
Also, I don't get why we are not showing an error with Bad credentials if we are still not using the KEYCHAIN. So, I have modified it to be able to see this message:
Furthermore, as it can be seen, I propose changing the beginning of that message (from "Failed to start Spotify client:" to "Spotify client error:"), as it will make sense in all scenarios. For instance, when spotify client crashes (e.g. myself killing the librespot process):
(You can see how I propose changing also the error messages from "Error 1" to "Process crashed").
Furthermore, since we can stop the client on purpose, and to avoid modifying the settings panel logic, I have updated that message to be "Process stopped or crashed", as can be both cases. I am reusing the
mainContent
variable to detect if we are closing the app to avoid showing error messages (established inevent->accept()
on closeEvent)Then, clicking in "Stop client":
But not errors are shown in a dialog. The same when we close the application window.